export default {
  state: {
    selectTab: 0,
    tabList: [{
      label: '基础信息',
      name: 'basicInfo'
    },{
      label: '历史订单',
      name: 'historyOrder'
    },{
      label: '历史点评',
      name: 'historyReview'
    },{
      label: '近30天点击',
      name: 'historyClick'
    },{
      label: '历史推送',
      name: 'historyPush'
    },{
      label: '推荐产品',
      name: 'recommendProduct'
    }]
  },
  getters: {
    tabName(state) {
      return state.tabList[state.selectTab].name
    }
  },
  mutations: {
    CHANGE_TAB_DATA:(state, data) => {
      if (data instanceof Array) {
        data.forEach(item => {
          state[item.query] = item.value
        })
      } else {
        state[data.query] = data.value
      }
    }
  },
  actions: {
    changeTabData({commit}, data){
      commit('CHANGE_TAB_DATA', data)
    }
  }
}
